package com.example.winner.simpleplay;

import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

/**
 * Created by winner on 2018/6/10.
 */

public class Music extends Service{
    private MediaPlayer player;
    @Override
    public void onCreate()
    {
        player= MediaPlayer.create(getApplicationContext(),R.raw.gequ);
        player.setLooping(true);
        super.onCreate();
    }
    @Override
    public IBinder onBind(Intent intent)
    {
        return null;
    }
    @Override
    public void onStart(Intent intent,int startId)
    {
        super.onStart(intent,startId);
        player.start();
    }
    @Override
    public void onDestroy()
    {
        super.onDestroy();
        player.stop();
    }
}
